From 1e7893c402b3a3de49012dedd00f86d6847aeddd Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 18 Oct 2016 00:24:53 -0500 Subject: [PATCH] pkgid: add the -p flag as the output suggests When you use this command and there are multiple packages that match this spec, the help instructions tell you to rerun it with the -p argument which was previously not present. Since the code paths are shared with 'cargo build' and 'cargo update', this adds the -p argument to 'cargo pkgid' to make things more consistent. Signed-off-by: Doug Goldstein --- src/bin/pkgid.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bin/pkgid.rs b/src/bin/pkgid.rs index 13aedf257..f9d90523c 100644 --- a/src/bin/pkgid.rs +++ b/src/bin/pkgid.rs @@ -11,6 +11,7 @@ pub struct Options { flag_manifest_path: Option, flag_frozen: bool, flag_locked: bool, + flag_package: Option, arg_spec: Option, } @@ -22,6 +23,7 @@ Usage: Options: -h, --help Print this message + -p SPEC, --package SPEC Argument to get the package id specifier for --manifest-path PATH Path to the manifest to the package to clean -v, --verbose ... Use verbose output -q, --quiet No output printed to stdout @@ -60,7 +62,14 @@ pub fn execute(options: Options, let root = try!(find_root_manifest_for_wd(options.flag_manifest_path.clone(), config.cwd())); let ws = try!(Workspace::new(&root, config)); - let spec = options.arg_spec.as_ref().map(|s| &s[..]); + let spec = if options.arg_spec.is_some() { + options.arg_spec + } else if options.flag_package.is_some() { + options.flag_package + } else { + None + }; + let spec = spec.as_ref().map(|s| &s[..]); let spec = try!(ops::pkgid(&ws, spec)); println!("{}", spec); Ok(None) -- 2.30.2